package com.xiyi.shouxin.entity.user.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;
import org.springframework.lang.Nullable;

import com.xiyi.shouxin.entity.user.Practice;

public class PracticeMapper implements RowMapper<Practice> {

    @Override
    @Nullable
    public Practice mapRow(@Nullable ResultSet rs, int rowNum) throws SQLException {
        Practice practice = new Practice();
        if (rs == null) {
            return practice;
        }
        practice.setId(rs.getLong("id"));
        practice.setUid(rs.getLong("uid"));
        practice.setPiciId(rs.getLong("pici_id"));
        practice.setAdminId(rs.getLong("admin_id"));
        practice.setDeviceId(rs.getString("device_id"));
        practice.setQualifiedQuantity(rs.getInt("qualified_quantity"));
        practice.setPassRate(rs.getDouble("pass_rate"));
        practice.setWeightNum(rs.getInt("weight_num"));
        practice.setTotal(rs.getInt("total"));
        practice.setIsCheck(rs.getInt("is_check"));
        practice.setIsDelete(rs.getInt("is_delete"));
        practice.setNotReset(rs.getInt("not_reset"));
        practice.setTime(rs.getLong("time"));
        practice.setCreatedAt(rs.getString("created_at"));
        return practice;
    }
}
